(function($) {

	 $.fn.numeral = function() {     
         $(this).css("ime-mode", "disabled");     
         this.bind("keypress",function(e) {     
         var code = (e.keyCode ? e.keyCode : e.which);   
             if(!$.browser.msie&&(e.keyCode==0x8))
             {     
                  return ;     
                 }     
                 return code >= 48 && code<= 57;     
         });     
 
     };
     
     $.fn.maxlength = function (settings) {
	    if (typeof settings == 'string') {
	        settings = { feedback : settings };
	    }

	    settings = $.extend({}, $.fn.maxlength.defaults, settings);

	    function length(el) {
	    	var parts = el.value;
	    	if ( settings.words )
	    		parts = el.value.length ? parts.split(/\s+/) : { length : 0 };
	    	return parts.length;
	    }
	    
	    return this.each(function () {
	        var field = this,
	        	$field = $(field),
	        	$form = $(field.form),
	        	limit = settings.useInput ? $form.find('input[name=maxlength]').val() : $field.attr('maxlength'),
	        	$charsLeft = $form.find(settings.feedback);

	    	function limitCheck(event) {
	        	var len = length(this),
	        	    exceeded = len >= limit,
	        		code = event.keyCode;

	        	if ( !exceeded )
	        		return;

	            switch (code) {
	                case 8:  // allow delete
	                case 9:
	                case 17:
	                case 36: // and cursor keys
	                case 35:
	                case 37: 
	                case 38:
	                case 39:
	                case 40:
	                case 46:
	                case 65:
	                    return;

	                default:
	                    return settings.words && code != 32 && code != 13 && len == limit;
	            }
	        }



	        $field.keyup(updateCount).change(updateCount);
	        if (settings.hardLimit) {
	            $field.keydown(limitCheck);
	        }

	       
	    });
	};




})(jQuery);


function setPicSlider() {
    var picItem = $(".pic-slider ul li");
    var picMainNode = $(".pics");
    var current = picItem.eq(0);
    var picUrl = current.attr("id");
    var originalUrl = current.attr("original");
    $("<img id='proImg' width='300px' height='360px' src='" + picUrl + "' class='jqzoom' jqimg='" + picUrl + "' />").appendTo(picMainNode);
    initZoom();
    picItem.mouseover(function () {
        picUrl = $(this).attr("id");
        originalUrl = $(this).attr("original");
        picMainNode.html("");
        jQuery("<img id='proImg' width='300px' height='360px' src='" + picUrl + "' class='jqzoom' jqimg='" + picUrl + "' />").appendTo(picMainNode);
        jQuery(this).addClass("hv_item");
        initZoom();
    })
	.mouseout(function () {
	    jQuery(this).removeClass("hv_item");
	});
    jQuery('#mycarousel').jcarousel({
        vertical: true,
        scroll: 5
    });
}

